Previous Next

Read an asset by ID, type, and site along with its dependent assets in an aggregated format

get
/resources/v1/aggregates/{siteName}/{assetType}/{assetId}
The resource endpoint returns information about any given asset, along with its dependent assets to any depth, belonging to a given site name. It is a Singular Resource.

Important Note: The response is in an aggregated asset format. All the aggregated asset responses contain a 'start' field. The 'root asset' referred to below is the asset to which the value of 'start' key points in the response. This asset is the starting asset at level 0 (requested asset, here {assetId}). We have to navigate through all dependent assets at the next levels in the response through this root asset.

Special Case : If the root asset or any dependent asset at any depth is of the collection asset type, such as ContentQuery or Recommendation, then in addition to asset data, results are also evaluated for the collection asset and given in the items array. The default number of results is 10. Each item is again an aggregated asset, and the query parameters are also applicable to it. WebCenter Sites Aggregate REST API recommends that you access collection resources through collection-asset-resource and recommendation assets through recommendation-resource because you have the ability to control the number of results and pagination.

The following tables summarize the client request.

Path Parameters
Name Description Format
assetId ID of the asset integer int64
assetType Name of the asset type string
siteName Name of the site string
Query Parameters
Name Description Format
assetDepth Accepts any positive integer or the string "all". The asset depth as an integer defines the tree level to which to traverse dependent assets. The string "all" refers to the full depth. The default value is 2. In case of an invalid assetDepth value (negative number), the default assetDepth value is used. string
expand This is used to control what asset types to expand in the response. Accepts a semicolon-separated list of asset types. The assets of these asset types will be expanded. Other asset types will not be expanded. However, the root asset (ref: note in resoure description) is always expanded. The default is to expand all asset types. Placing the NOT operator (!) before an asset type in the list indicates to exclude that asset type from the expansion.
For example:
  • expand=assetType1,assetType2. means expand only assets of 'assetType1' and 'assetType2'.
  • expand=!assetType1,!assetType2.means expand all assets except the assets of 'assetType1' and 'assetType2'.
string
fields This is used to control what attributes to return for an AssetType in the response. This query param works only if any asset of this assetType occurs within the given depth and that assetType is allowed to expand. Accepts a list of attributes, separated by commas, for an asset type in the format assetType1(attr1,attr2). It means to give only attr1 and attr2 for assetType1. If no asset type is specified, the attributes in the fields parameter are applicable only to the root asset (ref: note in resoure description). If the fields query parameter is not specified, then by default all attributes are given. This parameter can include wildcards, as follows
  • fields=*(attr1,attr2) gives only attr1 and attr2 for all asset types.
  • fields=!*(attr1,attr2,attr3) gives all attributes excluding att1, attr2, and attr3 for all asset types.
  • fields=!attr1,attr2 gives all attributes excluding attr1 and attr2 for the root asset.
string
links Accepts a comma-separated list of link names. By default, this parameter gives all the links (schema, self, and canonical resources). string
profileName Accepts a Visitor Services profile name. This profileName will be applied to the recommendation assets encountered at any depth to evaluate the results. string
segments Accepts a list of segment names, separated by commas, that exist in the sites. These segments will be applied to the recommendation assets encountered at any depth to evaluate the results. If segments are not specified, then this parameter uses the Default segment. string

The following tables summarize the server response.

Supported Media Types
  • application/json

200 Response

An asset's data in aggregated format

Example 1

The following example shows how to get only the name and createddate values of the AVIArticle asset with the ID 1328196047241 in the avisports sample site in WebCenter Sites, by submitting a GET request on the REST resource using cURL For more information, see Use cURL.

Query param details:

  • "fields=name,createddate": We need only these attributes for the root asset (AVIArticle:1328196047241).

  • "expand=AVIArticle": If any parent asset exists for the root asset, it is expanded by default. The root asset has the parent asset ArticleCategory:1327351719208. Here we are interested only in the root asset. So by specifying to expand only assets of type AVIArticle, we are restricting the expansion of assets of any other asset types, including parents.

curl -i -H "Accept: application/json" -X GET "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?fields=name,createddate&expand=AVIArticle"

Example 1 Response Header

The following example shows the response header.

HTTP/1.1 200 OK
ETag: "d6c2ff1d9e05321de07fb4a816f7baf8572e7304a1a5f00411b606fb4cb0fb41"
Cache-Control: max-age=0
Content-Type: application/json;charset=utf-8

Example 1 Response Body

The following example shows the contents of the response body, in JSON format.

{
  "start": "AVIArticle:1328196047241",
  "links": [
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?fields=name,createddate&expand=AVIArticle",
      "rel": "self",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    },
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?fields=name,createddate&expand=AVIArticle",
      "rel": "canonical",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    },
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/metadata-catalog/aggregates/avisports/AVIArticle/1328196047241",
      "rel": "describedby",
      "templated": false,
      "mediaType": "application/schema+json",
      "method": "GET",
      "profile": ""
    }
  ],
  "AVIArticle:1328196047241": {
    "name": "Veteran Skier Says Goodbye",
    "createddate": {
      "value": "2012-04-27T13:38:49.777Z",
      "timezone": "India Standard Time",
      "description": ""
    },
    "parents": [
      {
        "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351719208",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      }
    ]
  }
}

Example 2

The following example shows how to get name of the AVIArticle asset with the ID 1328196047241 along with the name of its related Image asset at depth 1 in the avisports sample site in WebCenter Sites, by submitting a GET request on the REST resource using cURL.

Query param details:

  • "assetDepth=1" : We need the details of a related image (dependent asset) at depth 1. So we need the aggregate asset data until depth 1.

  • "fields=name,relatedImage;AVIImage(name)": We are interested in (1) the name and relatedImage attributes for the root asset (AVIArticle:1328196047241) and (2) the name attribute for the relatedImage asset.

  • "expand=AVIArticle,AVIImage" : We are interested only in the root asset of type AVIArticle and its relatedImage asset of type AVIImage. So we are using this query param to restrict expansion of all other assets.

curl -i -H "Accept: application/json" -X GET "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?assetDepth=1&fields=name,relatedImage;AVIImage(name)&expand=AVIArticle,AVIImage

Example 2 Response Header

The following example shows the response header.

HTTP/1.1 200 OK
ETag: "84bf83ac6e36298a6e19297287f02223f852257754e2d23fafc79cbc85cbd70f"
Cache-Control: max-age=0
Content-Type: application/json;charset=utf-8

Example 2 Response Body

The following example shows the contents of the response body, in JSON format.

{
  "AVIImage:1327351719292": {
    "name": "Yellow Skier",
    "parents": [
      {
        "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ImageCategory/1327351718428",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      }
    ]
  },
  "start": "AVIArticle:1328196047241",
  "links": [
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?expand=AVIArticle,AVIImage&fields=name,relatedImage;AVIImage(name)&assetDepth=1",
      "rel": "self",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    },
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/AVIArticle/1328196047241?expand=AVIArticle,AVIImage&fields=name,relatedImage;AVIImage(name)&assetDepth=1",
      "rel": "canonical",
      "templated": false,
      "mediaType": "",
      "method": "",
      "profile": ""
    },
    {
      "href": "http://<host>:<port>/<context>/REST/resources/v1/metadata-catalog/aggregates/avisports/AVIArticle/1328196047241",
      "rel": "describedby",
      "templated": false,
      "mediaType": "application/schema+json",
      "method": "GET",
      "profile": ""
    }
  ],
  "AVIArticle:1328196047241": {
    "name": "Veteran Skier Says Goodbye",
    "relatedImage": {
      "id": 1327351719292,
      "type": "AVIImage"
    },
    "parents": [
      {
        "href": "http://<host>:<port>/<context>/REST/resources/v1/aggregates/avisports/ArticleCategory/1327351719208",
        "rel": "assetReference",
        "templated": false,
        "mediaType": "",
        "method": "GET",
        "profile": ""
      }
    ]
  }
}